<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<div id="editForProjectTaskFinishApply" class="easyui-window" title="项目任务完成审批" data-options="modal:true,closed:true,iconCls:'icon-search'" style="width:690px; height:480px;padding:5px;">
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'center'" style="padding:10px;">
			<form id="editForProjectTaskFinishApplyForm" method="post" action="checkProjectTaskFinishApply" style = "width:100%; height: 100%">
				<input type="hidden" id="projectTaskFinishApplyId" name = "id"/>
				<input type="hidden" id="projectTaskFinishApplyStatus" name = "status" value="3000"/>
				<input type="hidden" id="projectTaskFinishApplyProjectTaskId" name = "projectTaskPerson.id"/>
				<input type="hidden" id="projectTaskFinishApplyProjectTaskStatus" name = "projectTaskPerson.status" value="3000"/>
				<table width="100%" height="100%">
					<tr>
						<td width="130px;" align="right">项目名称：</td>
						<td colspan="3">
							<input class="easyui-textbox" id="lookProjectName" readonly="readonly" style="width: 500px;" />
						</td>
					</tr>
					<tr>
						<td width="130px;" align="right">任务：</td>
						<td colspan="3">
							<input class="easyui-textbox" id="lookProjectTaskTaskDescription" readonly="readonly" style="width: 500px;" />
						</td>
					</tr>
					<tr>
						<td width="130px;" align="right">职责：</td>
						<td colspan="3">
							<input class="easyui-textbox" id="lookProjectTaskTaskPersonDuty" readonly="readonly" style="width: 500px;" />
						</td>
					</tr>
					<tr>
						<td align="right">申请人：</td>
						<td>
							<input class="easyui-textbox" id="lookApplyPersonName" readonly="readonly" style="width: 200px;" />
						</td>
						<td align="right">申请时间：</td>
						<td>
							<input class="easyui-datetimebox" id="lookApplyTime" readonly="readonly" style="width: 200px;" />
						</td>
					</tr>
					<tr>
						<td align="right">申请说明：</td>
						<td colspan="3">
							<input class="easyui-textbox" data-options="multiline:true" style="width: 500px; height: 80px;" id="lookApplyDescription" readonly="readonly">
						</td>
					</tr>
					<tr>
						<td align="right">计划工时：</td>
						<td>
							<input class="easyui-textbox" id="lookPlanWorktime" readonly="readonly" style="width: 200px;" />
						</td>
						<td align="right">填报工时：</td>
						<td>
							<input class="easyui-textbox" id="lookOriginalConsumeWorktime" readonly="readonly" style="width: 200px;" />
						</td>
					</tr>
					<tr>
						<td align="right">确认工时：</td>
						<td>
							<input class="easyui-textbox" name="projectTaskPerson.confirmConsumeWorktime" id="lookConfirmConsumeWorktime" data-options="required:true" style="width: 200px;" />
						</td>
					</tr>
					<tr>
						<td align="right">审核意见：</td>
						<td colspan="3">
							<input class="easyui-textbox" data-options="multiline:true" style="width: 495px; height: 100px;" name="checkComment" id="lookCheckComment" />
						</td>
					</tr>
				</table>
			</form>
		</div>
		<div data-options="region:'south',border:false" style="text-align:right;padding:5px 0 0;">
			<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="$('#editForProjectTaskFinishApplyForm').submit()" style="width:80px">通过</a>
			<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#projectTaskFinishApplyProjectTaskStatus').val('0055');$('#projectTaskFinishApplyStatus').val('2001');$('#editForProjectTaskFinishApplyForm').submit()" style="width:80px">驳回</a>
			<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="javascript:$('#editForProjectTaskFinishApply').window('close')" style="width:80px">关 闭</a>
		</div>
	</div>
</div>
	
<script type="text/javascript">
	function editForProjectTaskFinishApply(id){
		$.ajax({
			url: "getProjectTaskFinishApply?id="+id, 
			success: function(data){
				clearForm("editForProjectTaskFinishApplyForm", "editForProjectTaskFinishApply");
				
				var val = $.parseJSON(data);
				$("#projectTaskFinishApplyStatus").val("3000");
				$("#projectTaskFinishApplyProjectTaskStatus").val("3000");
				$("#projectTaskFinishApplyProjectTaskId").val(val.projectTaskId);
				$("#projectTaskFinishApplyId").val(val.id);
				$("#lookProjectTaskTaskPersonDuty").textbox("setValue", val.projectTaskPersonDuty);
				$("#lookApplyTime").textbox("setValue", val.applyTime);
				$("#lookProjectName").textbox("setValue", val.projectName);
				$("#lookProjectTaskTaskDescription").textbox("setValue", val.projectTaskTaskDescription);
				$("#lookApplyPersonName").textbox("setValue", val.applyPersonName);
				$("#lookPlanWorktime").textbox("setValue", val.planWorktime);
				$("#lookOriginalConsumeWorktime").textbox("setValue", val.originalConsumeWorktime);
				$("#lookConfirmConsumeWorktime").textbox("setValue", val.originalConsumeWorktime);
				$("#lookApplyDescription").textbox("setValue", val.applyDescription);
			}
		});
	}
	
	$("#editForProjectTaskFinishApplyForm").form({
		onSubmit: function(){
			var isValid = $(this).form('validate');
			return isValid;	// 返回false将停止form提交 
	    },
		success:function(data){
			var val = $.parseJSON(data);
			if(val.success){
				$('#dg').datagrid('reload');
				bottomRight('提示', '操作成功！');
				$('#editForProjectTaskFinishApply').window('close');
			}else{
				$.messager.alert("提示", val.msg, "error");
			}
		}
	});
</script>
